//
//  GWLrc.m
//  QQ音乐
//
//  Created by qianfeng on 16/3/10.
//  Copyright © 2016年 高炜. All rights reserved.
//

#import "GWLrc.h"

@implementation GWLrc
-(GWLrc *)lrcWithLrcString:(NSString *)lrcStr
{
    
    NSString *timeLrc =[[[lrcStr componentsSeparatedByString:@"]"]firstObject]substringFromIndex:1];
    NSString *textLrc =[[lrcStr componentsSeparatedByString:@"]"]lastObject];
    self.lrcText =textLrc;
    self.lrcTime =[self timeInterValWithTimeStr:timeLrc];
    return self;
}
+(GWLrc *)lrcWithLrcString:(NSString *)lrcStr
{
    return [[self alloc]lrcWithLrcString:lrcStr];
}

-(NSTimeInterval)timeInterValWithTimeStr:(NSString *)str
{
    NSInteger min = [[[str componentsSeparatedByString:@":"]firstObject]integerValue];
    NSInteger sen =[[[[[str componentsSeparatedByString:@":"]lastObject]componentsSeparatedByString:@"."]firstObject]integerValue];
    NSInteger haomiao =[[[str componentsSeparatedByString:@"."]lastObject]integerValue];
    return min*60+sen+haomiao*0.01;
}

@end
